package leecode

import "strconv"

func simplifiedFractions(n int) []string {
	result := make([]string, 0, n)
	for i := 1; i <= n; i++ {
		for j := i + 1; j <= n; j++ {
			if gcd(i, j) == 1 {
				temp := strconv.Itoa(i) + "/" + strconv.Itoa(j)
				result = append(result, temp)
			}
		}
	}
	return result
}

// gcd函数，用于求最大公约数
func gcd(a, b int) int {
	for a != 0 {
		a, b = b%a, a
	}
	return b
}
